const {
  createProxyMiddleware
} = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
      '/api0',
      createProxyMiddleware({
        //目标地址
        target: 'http://127.0.0.1:6000',
        //伪装身份为目标地址
        changeOrigin: true,
        //去掉前缀
        pathRewrite: {
          '^/api0': ''
        }
      })
    ),
    app.use(
      '/api1',
      createProxyMiddleware({
        //目标地址
        target: 'http://127.0.0.1:8888',
        //伪装身份为目标地址
        changeOrigin: true,
        //去掉前缀
        pathRewrite: {
          '^/api1': ''
        }
      })
    )
};